<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>任务首页 - 灵伴即时</title>
    <meta name="author" content="小柒2012"/>
    <meta name="site" content="https://blog.52itstyle.com"/>
    <link rel="stylesheet" th:href="@{/iview/iview.css}">
    <script th:src="@{/libs/jquery-3.2.1.min.js}" type="text/javascript"></script>
    <script th:src="@{/libs/vue.min.js}" type="text/javascript"></script>
    <script th:src="@{/layer/layer.js}" type="text/javascript"></script>
    <script th:src="@{/iview/iview.min.js}" type="text/javascript"></script>
    <script th:src="@{/common.js}" type="text/javascript"></script>
    <style type="text/css">
        [v-cloak] {
            display: none;
        }
    </style>
</head>
<body>
<div id="app" v-cloak>

    <div style="margin-bottom: 6px;margin: 30px">
        <template>
            <i-table border :content="self" :columns="tableTitle" :data="JobData"></i-table>
            <br>
        </template>
    </div>
</div>
<script type="text/javascript">

    function getQueryString(name) {
        var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
        var r = window.location.search.substr(1).match(reg);
        if (r != null) {
            return r[2];
        }
        return null;
    }

    var vm = new Vue({
        el: '#app',
        data: {
            content: '',
            pageNo: 0,
            pageSize: 10,
            jobName: "",
            JobData: [],
            tableTitle: [{
                key: "jobName",
                title: "任务名称"
            }, {
                key: "jobUrl",
                title: "执行地址"
            }, {
                key: "jobStatus",
                title: "状态"
            }, {
                key: "jobResult",
                title: "执行结果"
            }, {
                key: "createTime",
                title: "执行时间"
            }]

        },
        methods: {
            //任务列表(自行实现分页)
            list: function () {
                var jobName = decodeURI(getQueryString('jobName'));
                $.ajax({
                    url: "/job/listLog",
                    type: "post",
                    data: {
                        'jobName': jobName,
                        'time': (new Date()).toString(),
                        "pageNo": this.pageNo,
                        'pageSize': this.pageSize
                    },
                    success: function (result) {
                        vm.JobData = result.msg;
                    }
                });
            }
        },
        created: function () {
            this.list();
        }
    })

</script>
</body>
</html>